<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const romam = 'LVIII';
        const mapping = {
            L: 50,
            V: 5,
            I: 1,
        }
        const expect = 58;

        let sum = 0;
        for (const letter of romam) {     
            sum += mapping[letter] ;
        }
        console.log(sum);
    </script>
</body>
</html>